//
//  HMComposeButton.swift
//  swift-新浪微博0
//
//  Created by 赵玉忠 on 16/9/7.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class HMComposeButton: UIButton {
    
    override var isHighlighted: Bool {
        set {
            
        }
        get {
            return false
        }
    }
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(){
        imageView?.contentMode = .center
        titleLabel?.textAlignment = .center
    }
    
    /// 调整子控件的位置
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let width = self.bounds.width
        let height = self.bounds.height
        
        imageView?.frame = CGRect(x: 0, y: 0, width: width, height: width)
        titleLabel?.frame = CGRect(x: 0, y: width, width: width, height: height - width)
    }
    
}
